<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">
		<meta name="author" content="">

		<title>Dashboard Template for Bootstrap</title>
		<!-- Bootstrap core CSS -->
		<link href="bootstrap.min.css" th:href="@{/webjars/bootstrap/4.4.1/css/bootstrap.min.css}" rel="stylesheet">

		<!-- Custom styles for this template -->
		<link href="dashboard.css" th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
		<style type="text/css">
			/* Chart.js */
			
			@-webkit-keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			@keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			.chartjs-render-monitor {
				-webkit-animation: chartjs-render-animation 0.001s;
				animation: chartjs-render-animation 0.001s;
			}
		</style>
	</head>

	<body>

		<div class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
				<div ></div>
				<a style="text-align:center; color:white; font-size:24px; "  >新型冠状病毒实时数据统计</a>
			<div ></div>
		</div>
		<div class="container-fluid" style="width: 1030px;">
			<div>

				<div id="main" style="height:400px;"></div>
				<form th:action="@{/query}" method="post">
					<div class="form-group">
						<button class="btn btn-primary" style="float:right;">查询</button>
						<input name="name" type="text" class="form-control" th:value="${name}" placeholder="China" style="float:left;width:900px;">
					</div>

				</form>
					<div class="table-responsive">
						<table class="table table-striped table-sm">
							<thead>
								<tr>
									<th style="width: 389.6px;">国家</th>
									<th style="width: 389.6px;">地区</th>
									<th style="width: 359.6px;">累计确诊</th>
									<th style="width: 359.6px;">新增确诊</th>
								</tr>
							</thead>
							<tbody>

								<tr th:each="emp:${customer}">
									<td th:text="${emp.country}"></td>
									<td th:text="${emp.state}"></td>
									<td th:text="${emp.latestTotalCases}"></td>
									<td th:text="${emp.diffFromPrevDay}"></td>

								</tr>
							</tbody>
						</table>
					</div>

			</div>
		</div>

		<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
		<script type="text/javascript" src="asserts/js/popper.min.js"></script>
		<script type="text/javascript" src="asserts/js/bootstrap.min.js"></script>

		<!-- Icons -->
		<script type="text/javascript" src="asserts/js/feather.min.js"></script>
		<script>
			feather.replace()
		</script>
		<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
		<script src="https://cdn.bootcss.com/echarts/4.6.0/echarts.min.js"></script>

		<!-- Graphs -->
		<script type="text/javascript" src="asserts/js/Chart.min.js"></script>
		<script th:inline="javascript">

			$(document).ready(function(){
				var myChart = echarts.init(document.getElementById('main'));
				myChart.showLoading();
				var names=[];
				var values=[];
				$.ajax({
					type : "post",
					async : true,
					url : "/EcharsShow",
					data : {},
					dataType : "json",
					success : function(result) {
						if (result) {
							for(var i=0;i<result.length;i++){
								names.push(result[i].country);
								values.push(result[i].latestTotalCases);
							}
							myChart.hideLoading();
							myChart.setOption({
								tooltip: {},
								legend: {
									data:['累计确诊']
								},
								xAxis: {
									data: names
								},
								yAxis: {
									type: 'value'
								},
								dataZoom: [
									{
										type: 'slider',
										start: 1,
										end: 35
									}
								],
								series: [{

									name: '累计确诊',
									type: 'bar',
									data: values
								}]
							});
						}
					},
					error : function(errorMsg) {
						alert("图表请求数据失败!");
						myChart.hideLoading();
					}
				});//end ajax
			});

		</script>

	</body>

</html>